home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ahoy: Best of 1985
/
Ahoy_Best_of_1985_1986_Double_L.d64
/
file lock s'85
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
4KB
|
165 lines
5 rem file lock v0222/85
10 goto 10000
50 poke 198,0
52 get a$:if a$="" then goto 52
55 return
70 rem wait for return
80 poke 198,0:poke 204,0
85 get a$:poke 207,0:if a$<>chr$(13) then goto 85
90 poke 204,1:print " "chr$(157);:return
100 rem wait for key
105 poke 198,0:poke 204,0
110 get a$:poke 207,0:if a$="" then goto 110
115 poke 204,1:print " "chr$(157);:return
150 rem box routine
152 gosub 190
155 print chr$(117);:for i=0 to w-2:print chr$(99);:next i:print chr$(105);
158 for j=0 to h-2:rw=rw+1:gosub 190
160 print chr$(103);:for i=0 to w-2:print " ";:next i:print chr$(104);
161 next j
162 rw=rw+1:gosub 190
165 print chr$(106);:for i=0 to w-2:print chr$(99);:next i:print chr$(107);
170 print bl$;:return
190 rem set cursor locatiom
195 poke 214,rw:poke 211,cl:sys 58640:return
200 rem read directory
210 open 15,8,15,"i0:":open 2,8,2,"#"
220 tk=18:sc=1:nf=0
230 print#15,"u1";2;0;tk;sc
240 get#2,a$:a$=a$+chr$(0):t=asc(a$)
250 get#2,a$:a$=a$+chr$(0):s=asc(a$)
260 for f=0 to 7:rem 8 entries/sec
270 print#15,"b-p";2;f*32+2
275 get#2,a$:if a$="" then a$=chr$(0)
280 a=asc(a$):if asc(a$)=0 then goto 325
285 l$=">":if (a and 64) =0 then l$="[160]"
290 get#2,a$:get#2,a$
300 f$=l$+""
305 for i=0 to 15:get#2,a$:if a$="" then a$=chr$(0)
310 if asc(a$)=160 then goto 320
315 f$=f$+a$
320 next i
322 fl$(nf)=f$:s(nf)=sc:en(nf)=f:nf=nf+1
325 next f
330 if t<>0 then tk=t:sc=s:goto 230
335 close2:close15
340 nf=nf-1:return
400 rem print formatted screen
405 print chr$(147);:print hd$:print
410 rw=2:cl=0:h=20:w=19:gosub 150:
415 rw=2:cl=20:h=20:w=19:gosub 150
450 rem fill screen with files
455 rw=3:cl=1:gosub 190:zn=0
460 for j=0 to 18:i=pg*38+zn*19+j
462 if sf(i)=0 then print fl$(i);:goto 464
463 if sf(i)=1 then print rv$fl$(i)ro$;
464 rw=rw+1:gosub 190:next j
465 rw=3:cl=21:gosub 190:zn=1
470 for j=0 to 18:i=pg*38+zn*19+j
472 if sf(i)=0 then print fl$(i);:goto 474
473 if sf(i)=1 then print rv$fl$(i)ro$;
474 rw=rw+1:gosub 190:next j
475 zn=0:return
500 rem scratch
510 nc$="scratch files "
515 gosub 800
519 open 15,8,15
520 for i=0 to nf:if sf(i)=0 then goto 540
525 f$=fl$(i):if left$(f$,1)=">" then goto 540
530 f$=right$(f$,len(f$)-1)
535 print#15,"s0:"f$:gosub 900
540 next i
550 close 15
599 return
600 rem lock
610 nc$=" lock files "
615 gosub 800
619 open 15,8,15:open 2,8,2,"#"
620 for i=0 to nf:if sf(i)=0 then goto 660
630 gosub 690
635 get#2,a$:if a$="" then a$=chr$(0)
640 ft=asc(a$):ft=(ft or 64)
650 gosub 680
655 gosub 900
660 next i
670 close 2:close15:return
680 gosub 695:print#2,chr$(ft);
684 print#15,"b-p";2;0
685 print#15,"u2";2;0;18;s(i):return
690 print#15,"u1";2;0;18;s(i)
695 print#15,"b-p";2;en(i)*32+2:return
699 return
700 rem unlock
705 rw=1:cl=12:gosub 190
710 nc$=" unlock files "
715 gosub 800
719 open 15,8,15:open 2,8,2,"#"
720 for i=0 to nf:if sf(i)=0 then goto 660
730 gosub 690
735 get#2,a$:if a$="" then a$=chr$(0)
740 ft=asc(a$):ft=(ft and 191)
750 gosub 680:gosub 900
760 next i
770 close 2:close15:return
800 rem select files
805 rw=1:cl=12:gosub 190:print yl$nc$;
806 rw=24:cl=0:gosub 190:print cd$;
807 rw=3:cl=18:gosub 190:print ar$;:j=0
810 gosub 50
811 if a$=cm$ then return
812 if a$=chr$(13) then gosub 820:goto 810
813 if a$=ar$ then goto 10000:rem exit and start over
814 if a$=chr$(19) then gosub 190:print " ";:gosub 1000:goto 805
815 if a$=chr$(157) then gosub 890:goto 810
816 if a$=chr$(17) then gosub 840:goto 810
817 if a$=chr$(145) then gosub 860:goto 810
818 if a$=chr$(29) then gosub 880:goto 810
819 goto 810
820 tp=cl:cl=cl-17:i=pg*38+zn*19+j
821 ifsf(i)=1thengosub190:printchr$(146)fl$(cf+i);:sf(i)=0:goto 824
823 if sf(i)=0 then gosub 190:print chr$(18)fl$(cf+i)chr$(146);:sf(i)=1
824 cl=tp:return
840 i=pg*38+zn*19+j:if i=nf then return
841 j=j+1:if j>19 then j=19
844 gosub 190:print " ";
845 rw=rw+1:if rw>21 then rw=21:j=j-1
850 gosub 190:print ar$;:return
860 j=j-1:if j<0 then j=0
861 gosub 190:print " ";
865 rw=rw-1:if rw<3 then rw=3
870 gosub 190:print ar$;:return
880 if nf<pg*38+19 then return
885 gosub 190:print " ";:rw=3:cl=38:j=0:zn=1:gosub 190:print ar$;:return
890 rem
895 gosub 190:print " ";:rw=3:cl=18:j=0:zn=0:gosub 190:print ar$;:return
900 input#15,a$,b$,c$,d$
905 rw=23:cl=0:gosub 190:print " ";
910 rw=23:cl=0:gosub 190:print a$"[160]"b$"[160]"c$"[160]"d$;:er=1:return
920 er=0:return
1000 if nf<38 then return
1005 pg=pg+1:if pg*38>nf then pg=0
1010 gosub 400:return
10000 clr:dim fl$(76),s(76),en(76),sf(76)
10005 bl$=chr$(154):yl$=chr$(158):rv$=chr$(18):ro$=chr$(146):ar$=chr$(95)
10010 poke 53280,11:poke 53281,0:print chr$(147)bl$;
10012 cd$=bl$+" <crsr> <home>"+yl$+" moves "+bl$+" <rtrn>"+yl$+" selects [160]"+bl$
10015 hd$=chr$(18)+" file lock v0222/85 "+chr$(146)
10020 print hd$;
10030 print:print "insert disk and hit "yl$"<return>"bl$;
10035 gosub 70:print:print "reading directory":
10040 gosub 200:pg=0:zn=0:gosub 400
10050 rw=24:cl=0:gosub 190
10055 printyl$ "scratch lock unlock page boot quit ? "bl$chr$(157);
10056 gosub 100
10060 if a$="q" then end
10065 if a$="s" then print a$;:cm$=a$:gosub 500:goto 10000
10070 if a$="l" then print a$;:cm$=a$:gosub 600:goto 10000
10075 if a$="u" then print a$;:cm$=a$:gosub 700:goto 10000
10080 if a$="b" then print a$;:goto 10000
10085 if a$="p" then print a$;:gosub 1000
10090 goto 10050
60000 close 15:open 15,8,15,"i0:":close15
60001 save "@0:file lock v0222",8
61000 open 15,8,15:input#15,a$,b$,c$,d$
61001 print:print a$"[160]"b$"[160]"c$"[160]"d$:close15:stop